<template>
	<view class="">
		<view class="formBox"> 
		<u-form :model="form" ref="uForm">
			<u-form-item label-width="200rpx" label="商品服务名称" prop="goodsServerName" required>
				<u-input v-model="form.goodsServerName" />
			</u-form-item>
			<u-form-item label-width="200rpx" label="销售价" prop="goodsServerPrice" required>
				<u-input v-model="form.goodsServerPrice" />
			</u-form-item>
			<u-form-item label-width="200rpx" label="数量" prop="goodsServerNumber" required>
				<u-input v-model="form.goodsServerNumber" />
			</u-form-item>
			<u-form-item label-width="200rpx" label-position="top" label="备注" prop="goodsServerDescribe">
				<u-input v-model="form.goodsServerDescribe" maxlength="20"  type="textarea "/>
			</u-form-item>
		</u-form>
		</view>

		<view class="lxdBtn" @click="submit">保存</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			
		};
	},
	methods: {
		submit() {
			this.$refs.uForm.validate(valid => {
				if (valid) {
					console.log('验证通过');
				} else {
					console.log('验证失败');
				}
			});
		}
	},
	// 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
	onReady() {
		this.$refs.uForm.setRules(this.rules);
	}
};
</script>